from torch.utils.tensorboard import SummaryWriter


"""
SummaryWriter：它是 PyTorch 与 TensorBoard 交互的核心工具，
用于将训练过程中的数据（如损失、准确率、图像等）写入日志文件，供 TensorBoard 可视化。
"""
writer = SummaryWriter("logs")
writer.add_image()
# y=x
for i in range(100):
    writer.add_scalar("y=x", i, i)

writer.close()
